package com.agv.core.dao.dataExtractor;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import org.springframework.jdbc.core.RowMapper;

public class GenericRowMapper implements RowMapper {

	public Map<String, String> mapRow(ResultSet rs, int index)
			throws SQLException {
		Map<String, String> map = new HashMap<String, String>();

		ResultSetMetaData rsmd = rs.getMetaData();
		
		int numCols = rsmd.getColumnCount();
		for (int i = 1; i <= numCols; i++) {
			map.put(rsmd.getColumnName(i), rs.getString(i));
		}
		return map;
	}
}
